package com.alpha.feign.common.entity;

import com.alpha.core.entity.AlphaEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * 资源实体
 *
 * @author chenruwan
 * @since 2022-01-01
 */
@Data
@Schema(name = "资源")
@Accessors(chain = true)
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class Resource extends AlphaEntity {
    @NotNull(message = "资源名称不能为空")
    @Schema(description = "资源名称")
    private String name;

    @NotNull(message = "资源地址不能为空")
    @Schema(description = "资源地址")
    private String url;

    @NotNull(message = "请求方法不能为空")
    @Schema(description = "请求方法")
    private String method;

    @SuppressWarnings("unused")
    public Resource(String name, String url, String method) {
        // NotNull fields
        this.name = name;
        this.url = url;
        this.method = method;
    }
}
